 /* 
 * File:   LateralAgent.h
 * Author: josep
 *
 * Created on 17 / desembre / 2010, 12:29
 */


#ifndef LATERALAGENT_H
#define	LATERALAGENT_H

#include "StateMachine/StateMachine.h"
#include "StateMachine/State.h"
#include "cAnimatedVisibleObject.h"
#include "cAgentCollisionEvent.h"


class cLateralAgent:public cAnimatedVisibleObject {
public:
    enum Estado {LEFT=0, RIGHT, MOVING_LEFT, MOVING_RIGHT, JUMPING_LEFT, JUMPING_RIGHT, DEATH};
    enum Transition {STOP=0, TO_LEFT, TO_RIGHT, JUMP, STOP_JUMP, DIE};
    cLateralAgent();
    cLateralAgent(const cLateralAgent &orig);
    virtual ~cLateralAgent();
    virtual void NextStep(int time);
    virtual void Init(cTexture *texture, int PosX=0, int PosY=0, int Width=0,
                                int Height=0);
    virtual bool isDead()=0;
    virtual cPhysicalObject* popChild();

    bool hasChild();
    void Stop();
    void Jump();
    void GoLeft();
    void GoRight();
    int GetViewState(int logicState);
protected:
    vector<int> FromLogicToViewCorrespondence;
    virtual void Notify(cPhysicalReaction *revent);
    virtual bool NotifyAgentCollision(cAgentCollisionEvent *revent);
    virtual int ChangeFramestate(int, int, int);
    virtual void SetInTheAir(bool inTheAir);
    virtual void ToDie();
    StateMachine<cLateralAgent> *sm;
    queue<cPhysicalObject*> children;
private:
    void Init();
    bool dying;
};


#endif	/* LATERALAGENT_H */

